﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Data;
using System.Data.SqlClient;
using Entity.Table;
using SqlHelper;

namespace DAL
{
    public class BankInfoDatabase
    {
        /// <summary>
        /// 根据银行编号获取银行。
        /// </summary>       
        /// <returns></returns>
        public static DataTable GetBankInfo(string bankCode)
        {
            DataTable dt = null;
            SqlConnection conn = null;            
           
            SqlParameter[] paramList = new SqlParameter[] { DbHelper.CreateCommandParameter("@BankCode", SqlDbType.VarChar, bankCode) };

            try
            {
                conn = DbHelper.CreateDbConnection(DbHelper.DbConnectionString);
                conn.Open();
                dt = DbHelper.GetTableByProcedure("GetBankInfoByCode_Sp", paramList, conn);
            }
            catch (SqlException ex)
            {
                dt = null;
            }
            finally
            {
                conn.Close();
            }

            return dt;
        }
    }
}
